package demo4;

import java.util.*;

public class demo4 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
//        map.put("123", "849898");
//        map.put("222", "wwww");
//        map.put("333", "dddd");
        System.out.println(map);
        Scanner in = new Scanner(System.in);
        map.put(in.next(),"11");
        System.out.println(map.containsKey("123"));
//        Set<String> keys = map.keySet();
//        for(String x : keys) {
//            System.out.println(map.get(x));
//        }
//        System.out.println("--------");
//        Collection<String> values = map.values();
//        for(String x : values) {
//            System.out.println(x);
//        }
//        System.out.println("--------");
//        Set<Map.Entry<String, String>> maps = map.entrySet();
//        for(Map.Entry<String, String> x : maps) {
//            System.out.println(x.getKey() + "," + x.getValue());
//        }
    }
    public static void main7(String[] args) {
        Test<String> t = new Test<String>();
        t.show("12www45");
        Test<Integer> t2 = new Test<Integer>();
        t2.show(123);
    }
    public static void main6(String[] args) {
        Gen2 gen2 = new Gen2();
        gen2.show("www");
        gen2.show(1465);
    }
    public static void main5(String[] args) {
        Gen<Integer> gen = new Gen<Integer>();
        gen.setP(1);
        System.out.println(gen.getP());
        Gen<String> gen1 = new Gen<String>();
        gen1.setP("123");
        System.out.println(gen1.getP());
    }
    public static void main0(String[] args) {
        TreeSet<String> tree = new TreeSet<>();
        tree.add("9");
        tree.add("2");
        tree.add("10");
        tree.add("5");
        for(String x : tree) {
            System.out.println(x);
        }
    }
    public static void main4(String[] args) {
        HashSet<String> set = new HashSet<>();
        set.add("5");
        set.add("d");
        set.add("1");
        boolean k = set.add("3");
        System.out.println(k);
//        for(String s : set) {
//            System.out.println(s);
//        }
//        Iterator<String> it = set.iterator();
//        while(it.hasNext()) {
//            System.out.println(it.next());
//        }
    }
    public static void main3(String[] args) {
        Collection<Student> list = new ArrayList<Student>();
        list.add(new Student("hh", 11));
        list.add(new Student("ww", 22));
        list.add(new Student("ee", 33));
//        Iterator<Student> it = list.iterator();
//        while(it.hasNext()) {
//            System.out.println(it.next());
//        }
        for(Student x : list) {
            System.out.println(x);
        }
    }
    public static void main1(String[] args) {
        Collection<String> list = new ArrayList<String>();
        list.add("1");
        list.add("2");
        list.add("3");
        Iterator<String> it = list.iterator();
        while(it.hasNext()) {
            System.out.println(it.next());
        }
    }
}

class Student {
    private String name;
    private int age;

    @Override
    public String toString() {
        return "Student [" +
                "name='" + name + '\'' +
                ", age=" + age +
                ']';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}